<?php                 
    $left_menu = ClassRegistry::init('Node.NodeType')->find('all',array(
        'conditions' => array('enabled' =>  1)
    ));
?>
<div id="sidebar">
    <a href="#" class="visible-phone"><i class="icon icon-home"></i> <?php echo __d('system','Dashboard');?></a>
    <ul>        
            <li class="active submenu open">
            <a href="index.html"><i class="glyphicon glyphicon-home"></i> <span><?php echo __d('system','Content Management');?></span></a>
            <?php if(!empty($left_menu)):?>        
                <ul> 
                    <?php $action = "admin_list_index";$class = $classActive = '';foreach($left_menu as $key=>$value):?>
                    <?php  $url='/node/node';
                        if(!in_array($this->params['action'],array('admin_comment_index','admin_comment_edit','admin_edit_contact','admin_edit_config_mail','admin_translate')))
                        {   $url = $this->Html->url(array('plugin'=>'node','controller' => $this->params['controller'], 'action' => $this->params['action'],$value['NodeType']['id']));}
                    ?>
                    <?php $classActive = $this->Menu->activeMainLinkAdmin($url,$this->here); ?>
                    <?php if(!empty($value['Term'])){$class = 'wd-hover';}?>                               
                        <li class="<?php echo $class;?> <?php echo $classActive;?>">
                            <a href="<?php 
                                   echo $this->Html->url(array('plugin'=>'node','controller'=>'node','action'=>'admin_list_index',$value['NodeType']['id']));
                                ?>"><?php echo __d('system',$value['NodeType']['name']);
                                ?></a>
                                <?php if(!empty($value['Term'])):?>
                                    <ul class="wd-sub-hover">
                                        <?php foreach($value['Term'] as $term_id=>$term_name):?>                                       
                                            <li><a href="<?php echo $this->Html->url(array('plugin'=>'node','controller'=>'node','action'=>'admin_list_index',$value['NodeType']['id'],$term_name['id']));?>"><?php echo $term_name['name'];?></a></li>                                    
                                        <?php endforeach;?>
                                    </ul>
                                <?php endif;$class = '';?>
                        </li>                
                    <?php $classActive = '';endforeach;?>                    
                </ul>            
            <?php endif;?>
        </li>
        
        <!--Manage Contact-->
        <?php 
            $url = $this->Html->url(array('plugin'=>'user','controller' => 'user', 'action' => 'admin_index'));
        ?>
        <li class="<?php echo $this->Menu->activeSimple('admin_manage_contact');?>">
            <a href="<?php echo $this->Html->url(array('plugin'=>'node','controller'=>'node','action'=>'manage_contact','?'=>array('simple_active'=>'manage_contact')));?>">
                <i class="glyphicon glyphicon-envelope"></i> <span><?php echo __d('system','Contact');?></span></a></li>
        <!--End-->                               
        
        <?php $url='/node/'
            //$url = $this->Html->url(array('plugin'=>'user','controller' => 'user', 'action' => $this->params['action']));debug($url);
        ?>            
        <li class="submenu">
            <a href="#"><i class="icon-user"></i> <span><?php echo __d('system','Users');?></span></a>
            <ul>                                
                <li class="<?php echo $this->Menu->activeMainLinkAdmin($url,$this->here);?>"><a href="<?php echo $this->Html->url(array('plugin'=>'user','controller'=>'user'));?>"><?php echo __d('system','User');?></a></li>                
                <li class="<?php echo $this->Menu->activeMainLinkAdmin($url,$this->here);?>"><a href="<?php echo $this->Html->url(array('plugin'=>'user','controller'=>'roles'));?>"><?php echo __d('system','Role');?></a></li>                
                <li class="<?php echo $this->Menu->activeMainLinkAdmin($url,$this->here);?>"><a href="<?php echo $this->Html->url(array('plugin'=>'user','controller'=>'permissions'));?>"><?php echo __d('system','Permision');?></a></li>
            </ul>
        </li>       
        
        <li class="submenu">
            <a href="#"><i class="glyphicon glyphicon-cog"></i> <span><?php echo __d('system','Config System');?></span></a>
            <ul>
                <li><a href="<?php echo $this->Html->url(array('plugin'=>'node','controller'=>'node','action'=>'admin_management_subsite'))?>"><?php echo __d('system','Subsite');?></a></li>
                <li><a href="<?php echo $this->Html->url(array('plugin'=>'node','controller'=>'node','action'=>'admin_management_language'))?>"><?php echo __d('system','Language');?></a></li>
                <li><a href="<?php echo $this->Html->url(array('plugin'=>'node','controller'=>'node','action'=>'manage_config_mail'))?>"><?php echo __d('system','Mail');?></a></li>              
                <li><a href="<?php echo $this->Html->url(array('plugin'=>'node','controller'=>'node_types'))?>"><?php echo __d('system','NodeType');?></a></li>
                <li><a href="<?php echo $this->Html->url(array('plugin'=>'block','controller'=>'block'))?>"><?php echo __d('system','Block');?></a></li>
            </ul>
        </li>
        
    </ul>
</div>